#include "model/scene.h"
#include "model/sphere.h"
#include "model/regular.h"

Scene::Scene(): ground(new RegularObject()), sphere(new Sphere()) {
    properties.lightSource = Vertex(500,500,500);
    properties.ilr = 100;
    properties.ilar = 80;
    properties.ilg = 100;
    properties.ilag = 80;
    properties.ilb = 100;
    properties.ilab = 80;
}

Scene::Scene(const Scene &scene, QObject *parent):QObject(parent) {
    this->setGround(new Object(*scene.getGround()));
    this->setSphere(new Object(*scene.getSphere()));
    this->setProperties(scene.getProperties());
}

Scene::~Scene() {
    delete this->ground;
    delete this->sphere;
}

void Scene::setGround(Object *ground){
    this->ground = ground;
    emit changed();
}

void Scene::setSphere(Object *sphere) {
    this->sphere = sphere;
    emit changed();
}

Object *Scene::getGround() const {
    return ground;
}

Object *Scene::getSphere() const {
    return sphere;
}

const std::vector<const Object *> Scene::getObjects() const {
    return std::vector<const Object*> {
        ground, sphere
    };
}

std::vector<Object *> Scene::getObjects() {
    return std::vector<Object*> {
        ground, sphere
    };
}

void Scene::setProperties(Scene::Light properties) {
    this->properties = properties;
    emit changed();
}

const Scene::Light Scene::getProperties() const {
    return this->properties;
}

Scene::Light Scene::getProperties() {
    return this->properties;
}

void Scene::setLightSourceX(light_t x) {
    this->properties.lightSource.x = x;
    emit changed();
}

void Scene::setLightSourceY(light_t y) {
    this->properties.lightSource.y = y;
    emit changed();
}

void Scene::setLightSourceZ(light_t z) {
    this->properties.lightSource.z = z;
    emit changed();
}

void Scene::setIlr(light_t i) {
    this->properties.ilr = i;
    emit changed();
}

void Scene::setIlg(double i) {
    this->properties.ilg = i;
    emit changed();
}

void Scene::setIlb(double i) {
    this->properties.ilb = i;
    emit changed();
}

void Scene::setIlar(light_t i){
    this->properties.ilar = i;
    emit changed();
}

void Scene::setIlag(light_t i){
    this->properties.ilag = i;
    emit changed();
}

void Scene::setIlab(light_t i){
    this->properties.ilab = i;
    emit changed();
}

void Scene::setGroundKar(light_t k) {
    this->ground->setKar(k);
    emit changed();
}

void Scene::setGroundKag(double k) {
    this->ground->setKag(k);
    emit changed();
}

void Scene::setGroundKab(double k) {
    this->ground->setKab(k);
    emit changed();
}

void Scene::setGroundKdr(light_t k) {
    this->ground->setKdr(k);
    emit changed();
}

void Scene::setGroundKdg(light_t k) {
    this->ground->setKdg(k);
    emit changed();
}

void Scene::setGroundKdb(light_t k) {
    this->ground->setKdb(k);
    emit changed();
}

void Scene::setGroundKsr(light_t k) {
    this->ground->setKsr(k);
    emit changed();
}

void Scene::setGroundKsg(light_t k) {
    this->ground->setKsg(k);
    emit changed();
}

void Scene::setGroundKsb(light_t k) {
    this->ground->setKsb(k);
    emit changed();
}

void Scene::setGroundN(light_t n) {
    this->ground->setN(n);
    emit changed();
}

void Scene::setSphereKar(light_t k) {
    this->sphere->setKar(k);
    emit changed();
}

void Scene::setSphereKag(double k) {
    this->sphere->setKag(k);
    emit changed();
}

void Scene::setSphereKab(double k) {
    this->sphere->setKab(k);
    emit changed();
}

void Scene::setSphereKdr(light_t k) {
    this->sphere->setKdr(k);
    emit changed();
}

void Scene::setSphereKdg(light_t k) {
    this->sphere->setKdg(k);
    emit changed();
}

void Scene::setSphereKdb(light_t k) {
    this->sphere->setKdb(k);
    emit changed();
}

void Scene::setSphereKsr(light_t k) {
    this->sphere->setKsr(k);
    emit changed();
}

void Scene::setSphereKsg(light_t k) {
    this->sphere->setKsg(k);
    emit changed();
}

void Scene::setSphereKsb(light_t k) {
    this->sphere->setKsb(k);
    emit changed();
}

void Scene::setSphereN(light_t n) {
    this->sphere->setN(n);
    emit changed();
}



